package shujia.day12.ketang;

/*
    自定义异常
 */

import java.util.Scanner;

class MyException extends Exception{
    public MyException(String message) {
        super(message);
    }
}

public class ExceptionDemo7 {
    public static void main(String[] args) {

        try {
            fun1();
        }catch (MyException e){
            e.printStackTrace();
        }

    }

    public static void fun1() throws MyException{
        Scanner sc = new Scanner(System.in);

        System.out.println("请输入考试成绩：");
        int score = sc.nextInt();

        if(score<60){
            throw new MyException("考试成绩低于60分");
        }else {
            System.out.println("请吃大餐！");
        }
    }
}
